﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Domain.Specification;

namespace Service
{
    public interface IProductsService<T, TPageData> : IService<T, TPageData> where T : class,new()
    {
        void Commit();
        void Add(T entity);
        void Update(T eneity);
        void Delete(T entity);
        void Delete(Func<T, Boolean> predicate);
        T GetById(int id);
        T Get(Func<T, Boolean> where);
        IQueryable<T> GetAll();
        IEnumerable<T> GetMany(Func<T, bool> where);
        TPageData Get<TS>(int pageIndex, int pageSize, Expression<Func<T, TS>> orderByExpression, bool isDesc);
        TPageData Get<TS>(int pageIndex, int pageSize, ISpecification<T> condition, Expression<Func<T, TS>> orderByExpression, bool isDesc);
        List<T> GetListByTopN<TS>(int topN, ISpecification<T> condition, Expression<Func<T, TS>> orderByExpression, bool isDesc);
    }
}
